﻿@model IEnumerable<WebChat.Models.Chatroom>
@{
    ViewBag.Title = "Meldinger";
}
<h2>
    Chatroom</h2>
<table>
    <tr>
        <th>
            Offentlig
        </th>
        <th>
            Aktivt
        </th>
        <th>
            Navn
        </th>
        <th>
            Dato
        </th>
        <th>
        </th>
    </tr>
    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.IsPublic)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Active)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Date)
            </td>
            <td>
                @Html.ActionLink("Endre", "EditChatrooms", new { id = item.Id }) |
                @Html.ActionLink("Detaljer", "DetailsRooms", new { id = item.Id }) |
                @Html.ActionLink("Beskjeder", "ListMessagesRoom", new { id = item.Id }) |
                @if (item.Active == "Yes")
                {
                    @Html.ActionLink("Deaktiver", "DeleteChatrooms", new { id = item.Id });
                }
                @if (item.Active == "No")
                {
                    @Html.ActionLink("Aktiver", "ActivateChatrooms", new { id = item.Id });
                }
            </td>
        </tr>
    }
</table>
<div>
    @Html.ActionLink("Tilbake", "Index")
</div>
